package com.poulpicious.ethanj.util;

import java.util.HashMap;
import java.util.Map;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.Sound;

public class ResourceManager {
	
	private static Map<String, Image> images = new HashMap<String, Image>();
	private static Map<String, Sound> sounds = new HashMap<String, Sound>();
	
	public static Image getImage(String name) {
		if(images.containsKey(name))
			return images.get(name);
		else
			return null;
	}
	
	public static Sound getSound(String name) {
		if(sounds.containsKey(name))
			return sounds.get(name);
		else
			return null;
	}
	
	public static void loadImage(String name, String filePath) {
		try {
			Image i = new Image(filePath);
			images.put(name, i);
		} catch (SlickException e) {
			e.printStackTrace();
		}
	}
	
	public static void loadSound(String name, String filePath) {
		try {
			Sound s = new Sound(filePath);
			sounds.put(name, s);
		} catch (SlickException e) {
			e.printStackTrace();
		}
	}

}
